package com.ldzy.signin.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

@Controller
public class ToPageController {
//返回二维码显示页面
    @GetMapping("/")
    public String toQrCodePage(Model model){
        model.addAttribute("info","21软件2班签到");
        return "getimg";
    }
//返回签到页面
    @GetMapping("/to-sign-in-page/{num}")
    public String toSignInPage(Model model,@PathVariable("num") String num){
        long timeStamp2 = System.currentTimeMillis();
        long timeStamp1 = Long.parseLong(num);
        if(timeStamp2-timeStamp1 > 20000){
            model.addAttribute("info","二维码已经过期,请重新扫码");
        }else {
            model.addAttribute("info","请输入姓名学号信息");
        }
        return "sign_in";
    }
}
